﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TienLen
{
    public partial class Options : Form
    {
        public Options()
        {
            InitializeComponent();
            Util.LoadCursor(this, CursorType.Default);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Options_Load(object sender, EventArgs e)
        { 
            gr_roundedge.Checked = TienLen.Properties.Settings.Default.opt_roundedge;
            gr_showbg.Checked = TienLen.Properties.Settings.Default.opt_showbg;
            ga_cursor.Checked = TienLen.Properties.Settings.Default.opt_cursor;
            ga_anim.Checked = TienLen.Properties.Settings.Default.opt_anim;
            gm_dp.Checked = TienLen.Properties.Settings.Default.opt_msndp;
            sg_soundeffect.Checked = TienLen.Properties.Settings.Default.opt_soundeffect;
            gm_saveType.SelectedIndex = TienLen.Properties.Settings.Default.opt_msnsavetype;
            gm_noSave.Checked = TienLen.Properties.Settings.Default.opt_msnnosave;
            gm_ptext.Checked = TienLen.Properties.Settings.Default.opt_msnptext;

            gc_resize.Checked = TienLen.Properties.Settings.Default.opt_resize;

            gm_save_CheckedChanged(sender, e);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            TienLen.Properties.Settings.Default.opt_roundedge = gr_roundedge.Checked;
            TienLen.Properties.Settings.Default.opt_showbg = gr_showbg.Checked;
            TienLen.Properties.Settings.Default.opt_soundeffect = sg_soundeffect.Checked;
            TienLen.Properties.Settings.Default.opt_cursor = ga_cursor.Checked;
            TienLen.Properties.Settings.Default.opt_anim = ga_anim.Checked;
            TienLen.Properties.Settings.Default.opt_msndp = gm_dp.Checked;
            TienLen.Properties.Settings.Default.opt_msnptext = gm_ptext.Checked;

            TienLen.Properties.Settings.Default.opt_resize = gc_resize.Checked;

            TienLen.Properties.Settings.Default.opt_msnnosave = gm_noSave.Checked;
            TienLen.Properties.Settings.Default.opt_msnsavetype = gm_saveType.SelectedIndex;
            TienLen.Properties.Settings.Default.Save();

            foreach (Form form in Application.OpenForms)
                Util.LoadCursor(form, CursorType.Default);

            this.Close();
        }

        private void gm_save_CheckedChanged(object sender, EventArgs e)
        {
            gm_saveType.Enabled = !gm_noSave.Checked;
        }
    }
}
